# calculate min x1, y1, z1

# calculate min x1
execute store result score x1 mt_surf_fill run data get entity @e[limit=1,tag=mt_surf_fill_in1] Pos[0]

execute store result score x1_temp mt_surf_fill run data get entity @e[limit=1,tag=mt_surf_fill_in2] Pos[0]
execute if score x1 mt_surf_fill < x1_temp mt_surf_fill run scoreboard players operation x1 mt_surf_fill = x1_temp mt_surf_fill

execute store result score x1_temp mt_surf_fill run data get entity @e[limit=1,tag=mt_surf_fill_in3] Pos[0]
execute if score x1 mt_surf_fill < x1_temp mt_surf_fill run scoreboard players operation x1 mt_surf_fill = x1_temp mt_surf_fill

# calculate min y1
execute store result score y1 mt_surf_fill run data get entity @e[limit=1,tag=mt_surf_fill_in1] Pos[1]

execute store result score y1_temp mt_surf_fill run data get entity @e[limit=1,tag=mt_surf_fill_in2] Pos[1]
execute if score y1 mt_surf_fill < y1_temp mt_surf_fill run scoreboard players operation y1 mt_surf_fill = y1_temp mt_surf_fill

execute store result score y1_temp mt_surf_fill run data get entity @e[limit=1,tag=mt_surf_fill_in3] Pos[1]
execute if score y1 mt_surf_fill < y1_temp mt_surf_fill run scoreboard players operation y1 mt_surf_fill = y1_temp mt_surf_fill

# calculate min z1
execute store result score z1 mt_surf_fill run data get entity @e[limit=1,tag=mt_surf_fill_in1] Pos[2]

execute store result score z1_temp mt_surf_fill run data get entity @e[limit=1,tag=mt_surf_fill_in2] Pos[2]
execute if score z1 mt_surf_fill < z1_temp mt_surf_fill run scoreboard players operation z1 mt_surf_fill = z1_temp mt_surf_fill

execute store result score z1_temp mt_surf_fill run data get entity @e[limit=1,tag=mt_surf_fill_in3] Pos[2]
execute if score z1 mt_surf_fill < z1_temp mt_surf_fill run scoreboard players operation z1 mt_surf_fill = z1_temp mt_surf_fill

scoreboard players add x1 mt_surf_fill 1
scoreboard players add y1 mt_surf_fill 1
scoreboard players add z1 mt_surf_fill 1